package com.iss.lxhproject.dao;

import com.iss.lxhproject.entity.Consume;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface ConsumeDao {
    @Insert("insert into consume values (null,#{consume_name},#{consume_price},#{consume_num},#{consume_unit},#{consume_usedperday},#{consume_text})")
    Integer insertConsume(Consume consume);

    @Select("select * from consume")
    List<Consume> selectAllConsume();
    @Delete(" <script>"+"delete from consume where consume_id in" +
            "    <foreach collection=\"array\" item=\"id\" separator=\",\" open=\"(\" close=\")\">" +
            "        #{id}" +
            "    </foreach>" +
            "</script>")
    Integer deleteConsume(Integer[] consume_id_Array);
    @Update("update consume set consume_name=#{consume_name},consume_price=#{consume_price},consume_num=#{consume_num},consume_unit=#{consume_unit},consume_usedperday=#{consume_usedperday},consume_text=#{consume_text} where consume_id=#{consume_id}")
    Integer updateConsume(Consume consume);
    @Select("select * from consume where consume_id=#{consume_id}")
    Consume selectConsumeById(Integer consume_id);










}
